// DlgCleanHistory.cpp : implementation file
//

#include "stdafx.h"
#include "XIE.h"
#include "DlgCleanHistory.h"


// CDlgCleanHistory dialog

IMPLEMENT_DYNAMIC(CDlgCleanHistory, CDialog)

CDlgCleanHistory::CDlgCleanHistory(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgCleanHistory::IDD, pParent)	
{
	m_bCacheFile = AfxGetApp()->GetProfileInt(_T("settings"), _T("CleanCacheFile"), 1);
	m_bCookies = AfxGetApp()->GetProfileInt(_T("settings"), _T("CleanCookies"), 0);
	m_bLastClose = AfxGetApp()->GetProfileInt(_T("settings"), _T("CleanLastClose"), 1);
	m_bHistory = AfxGetApp()->GetProfileInt(_T("settings"), _T("CleanHistory"), 1);
}

CDlgCleanHistory::~CDlgCleanHistory()
{
	AfxGetApp()->WriteProfileInt(_T("settings"), _T("CleanCacheFile"), m_bCacheFile);
	AfxGetApp()->WriteProfileInt(_T("settings"), _T("CleanCookies"), m_bCookies);
	AfxGetApp()->WriteProfileInt(_T("settings"), _T("CleanLastClose"), m_bLastClose);
	AfxGetApp()->WriteProfileInt(_T("settings"), _T("CleanHistory"), m_bHistory);
}

void CDlgCleanHistory::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Check(pDX, IDC_CHECK_CACHE, m_bCacheFile);
	DDX_Check(pDX, IDC_CHECK_HISTORY, m_bHistory);
	DDX_Check(pDX, IDC_CHECK_COOKIES, m_bCookies);
	DDX_Check(pDX, IDC_CHECK_LASTCLOSE, m_bLastClose);
}


BEGIN_MESSAGE_MAP(CDlgCleanHistory, CDialog)
	ON_BN_CLICKED(IDC_SELECT_ALL, &CDlgCleanHistory::OnBnClickedSelectAll)
	ON_BN_CLICKED(IDC_SELECT_NO, &CDlgCleanHistory::OnBnClickedSelectNo)
END_MESSAGE_MAP()


// CDlgCleanHistory message handlers

void CDlgCleanHistory::OnBnClickedSelectAll()
{
	// TODO: Add your control notification handler code here
	
	m_bLastClose = TRUE;
	m_bHistory = TRUE;
	m_bCookies = TRUE;
	m_bCacheFile = TRUE;
	UpdateData(FALSE);
}

void CDlgCleanHistory::OnBnClickedSelectNo()
{
	// TODO: Add your control notification handler code here
	m_bLastClose = FALSE;
	m_bHistory = FALSE;
	m_bCookies = FALSE;
	m_bCacheFile = FALSE;
	UpdateData(FALSE);
}

void CDlgCleanHistory::OnOK()
{
	// TODO: Add your specialized code here and/or call the base class
	UpdateData();
	CDialog::OnOK();
}
